<?php
namespace App\Model\Appfc114;

//use PhalApi\Model\NotORMModel as NotORM;
use Illuminate\Database\Eloquent\Model as Model;
use Illuminate\Database\Capsule\Manager as DB;

class User extends Model {

    protected $table = "wx_user";
    public $timestamps = false;


    public function getDetail($id, $field ="id"){
        $row = $this
            ->where($field,$id)
            ->first();
        return $row;
    }

    public function getListItems($page, $perpage) {
        return $this
            ->orderByRaw('id DESC')
            ->limit(($page - 1) * $perpage, $perpage)
            ->get();
    }

    public function getListTotal($state="") {
        $total = $this->where($state)->count();
        return intval($total);
    }
}
